/**
 * Copyright (c) 2010
 * Bert Young. UESTC. 
 */
 
#ifndef BERT_ENTRY_H
#define BERT_ENTRY_H

#include "MemoryPool.h"

struct Entry  : public MemoryPool
{    
protected:
	/**
	 * Constructor
	 */
	Entry() : id(0) 
	{
	}
public:
	/**
	 * Virtual destructor
	 */
	virtual ~Entry()
	{
	}
	/**
	 * ID
	 */
	union
	{
		unsigned int id;
		struct
		{
			unsigned short word1;
			unsigned short word2;
		};
		struct
		{
			unsigned char byte1;
			unsigned char byte2;
			unsigned char byte3;
			unsigned char byte4;
		};
	};
	/**
	 * Name max length
	 */
	static const int MAXNAMESIZE = 32;
	/**
	 * Name
	 */
	char name[MAXNAMESIZE];
	/**
	 * Get class name
	 */
	virtual const char * getClassName() const
	{
		return "Entry";
	}
};


template < typename T, typename ReturnType = bool>
struct Callback : public MemoryPool
{
	/**
	 * The callback method
	 */
	virtual ReturnType exec( T * entry) = 0;
	/**
	 * Virtual destructor
	 */
	virtual ~Callback()
	{
	}
};

#endif
